import {START, APPROVER, NOTIFY} from "@/components/EasyProcess/config/nodeType"
// 节点图标
import userIcon from "@/assets/images/bpm/user.png"
import approverIcon from "@/assets/images/bpm/approver.png"
import speakerIcon from "@/assets/images/bpm/speaker.png"

// 节点状态tag
import addSingIcon from "@/assets/images/bpm/addSing.png"
import checkIcon from "@/assets/images/bpm/check.png"
import errorIcon from "@/assets/images/bpm/error.png"
import runningIcon from "@/assets/images/bpm/running.png"
import rollbackIcon from "@/assets/images/bpm/rollback.png"
import transitionIcon from "@/assets/images/bpm/transition.png"
import appointIcon from "@/assets/images/bpm/appoint.png"
import revokeIcon from "@/assets/images/bpm/revoke.png"

// 审批状态
import approvePassIcon from "@/assets/images/bpm/approve_pass.png"
import approveSuspendIcon from "@/assets/images/bpm/approve_suspend.png"
import approveRejectIcon from "@/assets/images/bpm/approve_reject.png"
import approveRevokeIcon from "@/assets/images/bpm/approve_revoke.png"

export function getNodeIcon(nodeType) {
    switch (nodeType) {
        case START:
            return userIcon
        case APPROVER:
            return approverIcon
        case NOTIFY:
            return speakerIcon
        default:
            return userIcon
    }
}

export function getTag(nodeStatus, handleStatus, handleResult) {
    if (nodeStatus === '1') {
        return runningIcon
    } else {
        if (handleStatus === '2') {
            switch (handleResult) {
                case '1':
                    return checkIcon
                case '2':
                    return errorIcon
                case '3':
                    return addSingIcon
                case '4':
                    return appointIcon
                case '5':
                    return rollbackIcon
                case '6':
                    return revokeIcon
            }
        }
    }
    return null;
}

export function getApprovalStatusIcon(status) {
    switch (status) {
        case '2':
            return approveSuspendIcon
        case '3':
            return approveRevokeIcon
        case '4':
            return approvePassIcon
        case '5':
            return approveRejectIcon
        case '6':
            return revokeIcon
    }
    return null;
}